package com.excel;

import java.io.IOException;
import java.sql.Connection;
import java.sql.DatabaseMetaData;
import java.sql.DriverManager;
import java.sql.ResultSet;
import java.sql.ResultSetMetaData;
import java.sql.SQLException;
import java.sql.Statement;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.Hashtable;
import java.util.List;
import java.util.Map;
import java.util.Vector;

import org.htmlparser.Node;
import org.htmlparser.Parser;
import org.htmlparser.lexer.Lexer;
import org.htmlparser.tags.TableTag;
import org.htmlparser.util.NodeList;
import org.htmlparser.util.ParserException;
import com.excel.read.AllTable;
import com.excel.read.Config;
import com.excel.read.FormTable;

import jxl.write.WriteException;

public class PositionTest {

	static String schemal = "OA";
	static List tableNames = null;

//	public static void main(String args[]) {
//		Config.generateTable("d:\\");
//		PositionTest db = new PositionTest();
//		try {
//			db.init();
//		} catch (WriteException e1) {
//			e1.printStackTrace();
//		} catch (IOException e1) {
//			e1.printStackTrace();
//		}
//
//	}

//	public void init() throws WriteException, IOException {
//		
//		AllTable hm = Config.allPmb;
//		String names[] = hm.getFormNames();
//		for(int i=0; i<names.length; i++) {
//			FormTable form = hm.getForm(names[i]);
//			Map<String, String> positionMap = form.setNullContent();
//			try {
//				getTable(positionMap);
//			} catch (ParserException e) {
//				// TODO Auto-generated catch block
//				e.printStackTrace();
//			}
//			
//		}
//		
//		
//
//	}

	/**
	 * @param table
	 * @throws WriteException
	 * @throws IOException
	 * @throws ParserException
	 */
	public void getTable(Map<String, String> positionMap) throws WriteException, IOException,
			ParserException {		
		ExcelWriter excelWrite = new PositionExcelWriter("D:\\resource\\xls\\table_config.xls",
				positionMap);
		excelWrite.setTableDisplayName(null);
		excelWrite.setSheetName("Sheet1");
		excelWrite.setMode(ExcelWriter.FILE_CREATE_OR_READ,
				ExcelWriter.SHEET_CREATE_OR_READ);
		try {
			excelWrite.init();
			excelWrite.writeExcel();
		} catch (WriteException e) {
			e.printStackTrace();
		} catch (IOException e) {
			e.printStackTrace();
		} catch (SQLException e1) {
			e1.printStackTrace();
		}

	}

}
